package com.appointment.dto;

import com.appointment.utils.constants.PatternConstants;
import com.appointment.validation.AfterTimePeriod;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
public class AppointmentAddRequestDto {

    // 12 小时
    private static final long timePeriod = 12 * 60 * 60;

    @NotNull(message = "申请人姓名不能为空")
    @Pattern(regexp = PatternConstants.USER_NAME_PATTERN, message = "申请人姓名格式不正确")
    private String userName;

    @NotNull(message = "申请人手机号不能为空")
    @Pattern(regexp = PatternConstants.PHONE_PATTERN, message = "申请人手机号格式不正确")
    private String userPhone;

    @NotNull
    @Pattern(regexp = PatternConstants.CODE_PATTERN, message = "验证码格式不正确")
    private String code;

    @NotNull(message = "申请人身份证号不能为空")
    @Pattern(regexp = PatternConstants.USER_ID_CARD_PATTERN, message = "申请人身份证号格式不正确")
    private String userIdCard;

    @NotNull(message = "申请人单位不能为空")
    @Size(min = 1, max = 50, message = "申请人单位长度必须在1-50之间")
    private String userCompany;

    @NotNull(message = "专家不能为空")
    private String professorId;

    @NotNull(message = "预约时间不能为空")
    @AfterTimePeriod( timePeriod = timePeriod, message = "预约时间必须至少在半天后")
    private String appointmentTime;

    @NotNull(message = "预约事项不能为空")
    @Size(min = 1, max = 250, message = "预约事项长度必须在1-250之间")
    private String appointmentContent;
}
